// pages/API/add-contact/add-contact.js
Page({
  submit(e) {
    const formData = e.detail.value
    mp.addPhoneContact({
      ...formData,
      success(res) {
        console.log('addPhoneContact success:',res)
        mp.showToast({
          title: '联系人创建成功'
        })
      },
      fail(res) {
        console.log('addPhoneContact fail:',res)
        mp.showToast({
          title: '联系人创建失败'
        })
      }
    })
  },

  chooseContact(){
    mp.chooseContact({
      success (res) {
        mp.showToast({
          title: '联系人获取成功'
        })
        console.log('chooseContact sucess:' , res)
      },
      fail(res){
        mp.showToast({
          title: '联系人获取失败'
        })
        console.log('chooseContact fail:',res)
      }
    })
  }
})
